#include<iostream>
#include<vector>
using namespace std;

class Solution {
private:
	int search_bottom(vector<int>& nums, int target){
		int high = nums.size() - 1, low = 0;
		while(high >= low){
			int mid = (high + low) / 2;
			if(nums[mid] == target && (!mid || nums[mid - 1] < target))return mid;
			else if(nums[mid] < target){
				low = mid + 1;
			}
			else high = mid - 1;
		}
		return -1;
	}
	int search_top(vector<int>& nums, int target){
		int high = nums.size() - 1, low = 0;
		while(high >= low){
			int mid = (high + low) / 2;
			if(nums[mid] == target && (mid == nums.size() - 1|| nums[mid + 1] > target))return mid;
			else if(nums[mid] > target){
				high = mid - 1;
			}
			else low = mid + 1; 
		}
		return -1;
	}
public:
    vector<int> searchRange(vector<int>& nums, int target) {
		vector<int> ans = {search_bottom(nums, target), search_top(nums, target)};
		return ans;
    }
};

int main(){
	return 0;
} 
